#ifndef __PTGUI_DRIVER_H__
#define __PTGUI_DRIVER_H__

typedef struct ptgui_graphic_driver
{
	/* byte per pixel */
	rt_uint16_t	byte_per_pixel;

	/* screen width and height */
	rt_uint16_t	width;
	rt_uint16_t	height;

	/* screen update */
	void (*screen_update)(ptgui_rect_t *rect);

	/* get video frame buffer */
	rt_uint8_t *(*get_framebuffer)(void);

	/* set and get pixel in (x, y) */
	void (*set_pixel) (ptgui_color_t *c, rt_base_t x, rt_base_t y);
	void (*get_pixel) (ptgui_color_t *c, rt_base_t x, rt_base_t y);

	void (*draw_hline)(ptgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y);
	void (*draw_vline)(ptgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t y2);

	/* draw raw hline */
	void (*draw_raw_hline)(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y);
} ;

extern struct ptgui_graphic_driver _ptgui_scr_driver;
struct ptgui_graphic_driver *ptgui_graphic_driver_get_default(void);
void ptgui_graphic_driver_get_default_rect(ptgui_rect_t *rect);

typedef unsigned int ptgui_key_mode_t;
typedef unsigned short ptgui_key_code_t;
typedef unsigned short ptgui_key_scancode_t;
typedef struct ptgui_keyboard_driver
{
	rt_int32_t  (*open)(struct ptgui_keyboard_driver *pkd);
	void (*close)(void);
	void (*get_modifier_info)(ptgui_key_mode_t *modifiers, ptgui_key_mode_t *curmodifiers);
	rt_int32_t  (*read)(ptgui_key_code_t *buf, ptgui_key_mode_t *modifiers, ptgui_key_scancode_t *scancode);
	rt_int32_t  (*Poll)(void);
} ;

extern struct ptgui_keyboard_driver _ptgui_kbd_driver;
struct ptgui_keyboard_driver *ptgui_keyboard_driver_get_default(void);

typedef rt_int32_t ptgui_coord_t;	/* device coordinates*/
typedef struct ptgui_mouse_driver
{
	rt_int32_t	(*open)(struct ptgui_mouse_driver *);
	void	(*close)(void);
	rt_int32_t	(*get_button_info)(void);
	void	(*get_default_accel)(int *pscale, int *pthresh);
	rt_int32_t	(*read)(ptgui_coord_t *dx, ptgui_coord_t *dy, ptgui_coord_t *dz, int *bp);
	rt_int32_t	(*poll)(void);	/* not required if have select()*/
	rt_int32_t	flags;		/* raw, normal, transform flags*/
};
extern struct ptgui_mouse_driver _ptgui_mou_driver;
struct ptgui_mouse_driver *ptgui_mouse_driver_get_default(void);

#endif
